use super::base::ToHtml;

pub struct Tag{
    pub name:String,
    pub data:Vec<Box<dyn ToHtml>>
}
impl Tag{
    // pub fn new(&self,name:String,element:Vec<Box<dyn ToHtml>>)->Self{
    //     tag{
    //         name:name,
    //         data:element
    //     }
    // }
}
impl ToHtml for Tag{
    fn to_html(&self) -> String{
        let mut html: String = String::new();
        html.push_str(format!("<{}>",self.name).as_str());
        for element in &self.data{
            html.push_str(element.to_html().as_str());
        }
        html.push_str(format!("</{}>",self.name).as_str());
        html
    }
}